package com.flow.asyncflow.test;


import com.flow.asyncflow.test.asyncflow.model.plusasyncflowtest.PlusAsyncFlowTestResponse;
import com.flow.asyncflow.test.manager.asyncflowtest.PlusAsyncFlowTestManager;
import com.flow.asyncflow.test.asyncflow.model.plusasyncflowtest.PlusAsyncFlowTestRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/AsyncFlowTest")
public class AsyncFlowTestController {


    @Autowired
    private PlusAsyncFlowTestManager plusAsyncFlowTestManager;

    @GetMapping("Test")
    public String test() {
        //StopWatch sw = new StopWatch();
        //sw.start("第一步");
        PlusAsyncFlowTestRequest request = new PlusAsyncFlowTestRequest("请求参数");
        request.setBusinessSerialId(LocalDateTime.now().toString());
        request.setOperateName("测试");
        request.setOperateNo("110");
        request.setSourceDes("测试请求");
        request.setReqTypeEnum(com.flow.asyncflow.test.asyncflow.operatorenum.plusasyncflowtest.PlusAsyncFlowTestOperatorEnum.PlusAsyncFlowTest);
        PlusAsyncFlowTestResponse response;

        response = plusAsyncFlowTestManager.exec(request, com.flow.asyncflow.test.asyncflow.operatorenum.plusasyncflowtest.PlusAsyncFlowTestOperatorEnum.PlusAsyncFlowTest, PlusAsyncFlowTestResponse.class, com.flow.asyncflow.test.asyncflow.context.plusasyncflowtest.PlusAsyncFlowTestContext.class);

        return response.getMsg();

    }
}
